﻿using www.w3.org.Item2001.XMLSchema;

namespace Sidvall.CodeGenerator.DataObjects
{
	public class SchemaSimpleType : SchemaItem
	{
		public simpleType Item { get; set; }

        public override string ToString()
        {
            return this.Item.Content.name;
        }
	}

	public class SchemaSimpleTypeCollection : System.Collections.ObjectModel.KeyedCollection<simpleType, SchemaSimpleType>
	{

		#region Business Members

		#region Add

		public void Add(schema parent, simpleType item, string fileName)
		{
			SchemaSimpleType value;

			if (parent == null)
				throw new System.ArgumentNullException("parent");
			if (item == null)
				throw new System.ArgumentNullException("item");
			if (Contains(item))
				return;

			value = new SchemaSimpleType()
			{
				Item = item,
				Parent = parent,
				FileName = fileName
			};
			Add(value);
		}

		#endregion
		#region GetKeyForItem

		protected override simpleType GetKeyForItem(SchemaSimpleType item)
		{
			if (item == null)
				throw new System.ArgumentNullException("item");
			return item.Item;
		}

		#endregion

		#endregion
		#region Constructors

		public SchemaSimpleTypeCollection()
		{
		}

		#endregion

	}
}
